<template>
    <div class="container">
        <el-input-number v-if="propJson.isMaxNum && propJson.isMinNum" v-model="modelValue.variableValue" :min="propJson.minNum"
                         :max="propJson.maxNum" :disabled="propJson.isDisable"
                         :step="propJson.step" :step-strictly="propJson.stepStrictly"
                         :controls-position="propJson.controlsPosition" :size="propJson.size"/>

        <el-input-number v-if="!propJson.isMaxNum && propJson.isMinNum" v-model="modelValue.variableValue" :min="propJson.minNum"
                         :disabled="propJson.isDisable"
                         :step="propJson.step" :step-strictly="propJson.stepStrictly"
                         :controls-position="propJson.controlsPosition" :size="propJson.size"/>

        <el-input-number v-if="propJson.isMaxNum && !propJson.isMinNum" v-model="modelValue.variableValue"
                         :max="propJson.maxNum" :disabled="propJson.isDisable"
                         :step="propJson.step" :step-strictly="propJson.stepStrictly"
                         :controls-position="propJson.controlsPosition" :size="propJson.size"/>

        <el-input-number v-if="!propJson.isMaxNum && !propJson.isMinNum" v-model="modelValue.variableValue"
                         :disabled="propJson.isDisable"
                         :step="propJson.step" :step-strictly="propJson.stepStrictly"
                         :controls-position="propJson.controlsPosition" :size="propJson.size"/>
    </div>
</template>

<script name="InputNumberComponent" setup lang="ts">
import {getCommonParamObj} from "@/utils/commonParamUtil";
import {computed, defineProps} from "vue";

let props = defineProps(['propJson', 'commonParam']);

let propJson = computed(() => {return props['propJson']})
let commonParam = computed(() => {return props['commonParam']})

let modelValue = computed(() => {
    let modelParamObj = getCommonParamObj(commonParam.value, propJson.value.bindVariable);
    if (!modelParamObj) {
        return {};
    } else {
        return modelParamObj;
    }
})
</script>

<style scoped lang="less">

</style>